import yaml
import os
from class09.common import dir_config as Dir
import jsonpath

class Data:

    def __init__(self,key=None,filename="testdatas.yaml"):
        filepath = os.path.join(Dir.testdatas_dir, filename)
        with open(filepath, encoding="utf-8") as yaml_file:
            self.datas = yaml.load(yaml_file, Loader=yaml.FullLoader)
            if key!=None:
                self.data = jsonpath.jsonpath(self.datas,f"$..{key}")

if __name__ == '__main__':
    data=Data(filename='loginfail.yml').datas
    print(data)









